package com.spark.searchservice.controller;


import com.spark.searchservice.service.IPmsProductService;
import com.spark.basecommon.api.R;
import com.spark.searchapi.entity.PmsProduct;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 商品信息 前端控制器
 * </p>
 *
 * @author fuqiang
 * @since 2020-10-31
 */
@RestController
@RequestMapping("product")
@Api(tags = "商品搜索模块")
public class PmsProductController {

    @Autowired
    private IPmsProductService pmsProductService;

    @GetMapping("/getAll")
    @ApiOperation(notes = "获取所有商品", value = "所有商品")
    public R<List<PmsProduct>> getAll(){
        List<PmsProduct> list = pmsProductService.list();
        return R.success(list);
    }

    @PostMapping("/updateProduct")
    public R<Boolean> updateProduct(@RequestBody Long id){
        PmsProduct pmsProduct = new PmsProduct();
        pmsProduct.setId(id);
        pmsProduct.setBrandName("logstash_input_jdbc插件 实施同步更新");
        return R.success(pmsProductService.updateById(pmsProduct));
    }
}
